Skip to content

fix: use common type for numeric check on binary subtraction#3003

Merged
HerrCai0907 merged 2 commits intoAssemblyScript:mainfrom
cuiweixie:fix/binary-subtract-common-type-numeric-check
Mar 28, 2026
Merged

fix: use common type for numeric check on binary subtraction#3003
HerrCai0907 merged 2 commits intoAssemblyScript:mainfrom
cuiweixie:fix/binary-subtract-common-type-numeric-check

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

Summary

For non-compound binary -, the compiler computes commonType from both operands. The numeric validity check incorrectly used leftType.isNumericValue instead of commonType.isNumericValue.

Change

  • Use commonType.isNumericValue so the check matches the type used for implicit conversion and makeSub.

Contributor

Non-compound `-` computes `commonType` for both operands; the validity
check should use `commonType.isNumericValue`, not `leftType.isNumericValue`.
Copy link
Copy Markdown
Member

@MaxGraey MaxGraey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@HerrCai0907 HerrCai0907 merged commit fed7ffa into AssemblyScript:main Mar 28, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants